

// 科技成果----学术著作

import { CHECC_API_CMS } from '@/constants/proxy'
import request from '@/utils/request'
import { exportMethod } from '@/utils/utils'
import * as proxy from '@/constants/proxy'



//导出
const getExport=(data: any,fileName)=> {
  const params = {
    method:'post',
    url: CHECC_API_CMS + '/kjsl/tresult/academicwork/export',
    data:data,
    fileName:fileName
  }
  return exportMethod(params)
}


// 数据字典
const getDictionary = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/dictItem/codelist`,
    data
  )
}


// // 获取用户单位
// const getUnit = (data: any = {}) => {
//   return request.post(
//     CHECC_API_CMS + `/kgptKjslTchieveSttrans/unitname`,
//     data
//   )
// }
//全部机构单位
const getUnit = () => {
  return request({
    url: proxy.CHECC_API_CMS + '/org/selectTreeByLoginOrg',
    method: 'get',
  })
}

// 著作人

const getUser = (data: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/user/getAll`,
    data
  )
}

// 项目
const getProject = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/xmzx/projectManagement/undertakeunit`,
    data
  )
}

const getTechnology = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/xmzx/projectManagement/undertakeunit`,
    data
  )
}

// 详情

const getDetailById = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/academicwork/getDetailById/${id}`,
  )
}


//新加/增加

const addForm = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/kjsl/tresult/academicwork/add`,
    data
  )
}

//新加/编辑

const editForm = (data: any = {}) => {
  return request.post(
    CHECC_API_CMS + `/kjsl/tresult/academicwork/update`,
    data
  )
}


// 查询列表


const getTable=(data: any)=> {
  return request({
    url:  CHECC_API_CMS + '/kjsl/tresult/academicwork/list',
    method: 'post',
    data
  })
}

// 解锁

const getUnlock = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/academicwork/unlock/${id}`,
  )
}

// 锁定

const getLock = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/academicwork/lock/${id}`,
  )
}

// 导出功能




// 确定当前流程

const getConfirm = (id: any = {}) => {
  return request.get(
    CHECC_API_CMS + `/kjsl/tresult/academicwork/submit/${id}`,
  )
}

//删除(批量)
const getDelect = (id: any = {}) => {
  return request.delete(
    CHECC_API_CMS + `/kjsl/tresult/academicwork/${id}`,
  )
}

export { addForm, editForm, getConfirm, getDelect, getDetailById, getDictionary, getExport, getLock, getProject, getTable, getTechnology, getUnit, getUnlock, getUser }

